package org.example.lottery_system.common.config;

import jakarta.annotation.Resource;
import org.example.lottery_system.common.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class AppConfig implements WebMvcConfigurer {
    @Resource
    LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/**.html")
                .excludePathPatterns("/**.css")
                .excludePathPatterns("/**.js")
                .excludePathPatterns("/**.png")
                .excludePathPatterns("/user/password/login")
                .excludePathPatterns("/register");
    }
}
